<%@ include file="/WEB-INF/pages/common/taglibs.jsp" %>
<%@ include file="/WEB-INF/pages/common/checkpermission.jsp" %>
<%@ include file="/WEB-INF/pages/cases/case2/checkCase2Permission.jsp" %>
<codelookup:codeCollection id="deptList" codeType="DEPT_LIST"/>

<script type="text/javascript">
    function saveRecord() {
        var currentForm = document.forms["editForm"];
        currentForm.elements["caseTwoModel.infoSourcer"].value = currentForm.elements["caseTwoModel.infoSourcer"].value.trim();
        currentForm.elements["caseTwoModel.dutyOfficer"].value = currentForm.elements["caseTwoModel.dutyOfficer"].value.trim();
        currentForm.elements["caseTwoModel.workPosition"].value = currentForm.elements["caseTwoModel.workPosition"].value.trim();
        currentForm.elements["caseTwoModel.referTerm"].value = currentForm.elements["caseTwoModel.referTerm"].value.trim();
        if(validationMonitorForm('<s:text name="label.required.prefix"/>')){
            var checkDate=true;
            if(checkDate){
                 submitForm("editForm", "save.action");
            }
        }
        return false;
    }

    function cancelRecord() {
       submitForm("editForm", "search.action");
    }
    
     function fclick(obj, objButton) {
       with (obj) {
           scrollTop = event.y - offsetHeight / 2
           style.posLeft = event.x - offsetWidth / 2
       }
     }

     function downloadAttach(recordName,recordType){
         var currentForm = document.forms["editForm"];
        currentForm.elements["caseTwoModel.selectId"].value = recordName;
        currentForm.elements["caseTwoModel.selectType"].value = recordType;
        submitForm("editForm", "download.action");
    }
</script>

<s:form name="editForm" action="" enctype="multipart/form-data">
    <s:hidden name="caseTwoModel.caseTwoId"/>
    <s:hidden name="caseTwoModel.selectId"/>
    <s:hidden name="caseTwoModel.selectType"/>
    <s:hidden name="caseTwoModel.createDt"/>
    <s:hidden name="caseTwoModel.createId"/>
   <table align="center" cellpadding="0" cellspacing="0" class="body_content full_width">
            <tr>
                <td align="left" valign="bottom" class="main_page_content_icon" width="4%">
                    <img src='<c:url value="/images/body-icon_check.gif"/>' width="29" height="44">
                </td>
                <td valign="bottom" class="page_title_bg" width="96%"><span class="page_title"><s:text
                        name="label.case.select.title2"/></span></td>
            </tr>
            <tr>
                <td class="subcontent" colspan="2">&nbsp;</td>
            </tr>
    </table>
  <table border="0" align="center" cellpadding="0" cellspacing="0" class="body_content full_width bordered">
        <tr class="section_title">
            <td class="section_title" colspan="3">
                &nbsp;</td>
        </tr>
        <tr class="odd">
            <td class="form_label_padded" width="10%" nowrap><s:text name="label.casetwo.infoSourcer"/></td>
            <td class="form_label_padded" width="2%">:</td>
            <td class="txtData" align="left">
                    <s:textfield name="caseTwoModel.infoSourcer" maxlength="100"/>
            </td>
        </tr>
        <tr class="even">
            <td class="form_label_padded" width="10%" nowrap><s:text name="label.casetwo.dutyOfficer"/></td>
            <td class="form_label_padded" width="2%">:</td>
            <td class="txtData" align="left">
                    <s:textfield name="caseTwoModel.dutyOfficer" maxlength="100"/>
            </td>
        </tr>
        <tr class="odd">
            <td class="form_label_padded" width="10%" nowrap><s:text name="label.deptId"/></td>
            <td class="form_label_padded" width="2%">:</td>
            <td class="txtData" align="left">
                <s:select list="#attr.deptList" name="caseTwoModel.deptId" listKey="codeId" listValue="codeDesc"/>
            </td>
        </tr>
        <tr class="even">
            <td class="form_label_padded" width="10%" nowrap><s:text name="label.casetwo.workPosition"/></td>
            <td class="form_label_padded" width="2%">:</td>
            <td class="txtData" align="left">
                <s:textarea name="caseTwoModel.workPosition" cols="120" rows="10" onkeyup="checkTextAreaMaxLength(this,1000);"/>
            </td>
        </tr>
        <tr class="odd">
            <td class="form_label_padded" width="10%" nowrap  valign="top"><s:text name="label.casetwo.referTerm"/></td>
            <td class="form_label_padded" width="2%" valign="top">:</td>
            <td class="txtData" align="left">
                    <s:textarea name="caseTwoModel.referTerm" cols="120" rows="10" onkeyup="checkTextAreaMaxLength(this,1000);"/>
            </td>
        </tr>
    <s:if test="caseTwoModel.upload1FileName!=null">
        <tr class="even">
            <td class="form_label_padded" width="10%" nowrap><s:text name="label.attachment"/></td>
            <td class="form_label_padded" width="2%">:</td>
            <td class="txtData" align="left">
                 <a href="javascript:downloadAttach('<s:property value="caseTwoModel.caseTwoId"/>','1')">
                    <s:property value="caseTwoModel.upload1FileName"/>
                 </a>
            </td>
        </tr>
        </s:if>
        <tr class="even">
            <td class="form_label_padded" width="10%" nowrap><s:text name="label.publish.content"/></td>
            <td class="form_label_padded" width="2%">:</td>
            <td class="txtData" align="left">
                    <input id="f_file1" readonly="true">&nbsp;<input type="button" onmouseover="fclick(t_file1,this)"
                                                                value="<s:text name='label.browse'/>" class="button">
                    <s:file name="caseTwoModel.upload1" contentEditable="false" style="position:absolute;filter:alpha(opacity=0);width:30px;" id="t_file1"
                                       onchange="f_file1.value=this.value" />
            </td>
        </tr>
        <s:if test="caseTwoModel.upload2FileName!=null">
        <tr class="odd">
            <td class="form_label_padded" width="10%" nowrap><s:text name="label.attachment"/></td>
            <td class="form_label_padded" width="2%">:</td>
            <td class="txtData" align="left">
                 <a href="javascript:downloadAttach('<s:property value="caseTwoModel.caseTwoId"/>','2')">
                    <s:property value="caseTwoModel.upload2FileName"/>
                 </a>
            </td>
        </tr>
        </s:if>
        <tr class="odd">
            <td class="form_label_padded" width="10%" nowrap><s:text name="label.feedback.content"/></td>
            <td class="form_label_padded" width="2%">:</td>
            <td class="txtData" align="left">
                    <input id="f_file2" readonly="true">&nbsp;<input type="button" onmouseover="fclick(t_file2,this)"
                                                                value="<s:text name='label.browse'/>" class="button">
                    <s:file name="caseTwoModel.upload2" contentEditable="false" style="position:absolute;filter:alpha(opacity=0);width:30px;" id="t_file2"
                                       onchange="f_file2.value=this.value" />
            </td>
        </tr>
      </table>
      <table>
        <tr>
            <td class="txtData" colspan="3">
                <input type="button" class="button" value="<s:text name='label.save'/>" onclick="saveRecord();">
                <input type="button" class="button" value="<s:text name='label.back'/>" onclick="cancelRecord();">
            </td>
        </tr>
    </table>
</s:form>



